param( $ManifestDiff
     , [string]$SourceDir=$(Throw "Parameter SourceDir is required")
     , [string]$DestinationDir=$(Throw "Parameter DestinationDir is required")
     , [switch]$Whatif
     )

begin
{
	function FilePath($file,$baseDir)
	{
		[System.IO.FileInfo]$fileInfo = Join-Path $baseDir $file.RelativePath
		$fileInfo.FullName
	}
	
	function ProcessManifestDiff($ManifestDiff)
	{
		foreach ($File in $ManifestDiff.Added)
		{
			Write-Output "Copy $(PsSyncFileItemPath $file $SourcePath) to $(FilePath $file $DestinationPath)"
		}
		
		foreach ($File in $ManifestDiff.Changed)
		{
			Write-Output "Copy $(PsSyncFileItemPath $file $SourcePath) to $(FilePath $file $DestinationPath)"
		}
		
		foreach ($File in $ManifestDiff.Deleted)
		{
			Write-Output "Delete $(PsSyncFileItemPath $file $DestinationPath)"
		}

		foreach ($RemamedItem in $ManifestDiff.Renamed)
		{
			Write-Output "rename-item -path $(PsSyncFileItemPath $RemamedItem.Old $DestinationPath) -newname $(FilePath $RemamedItem.New $DestinationPath)"
		}
	}
	
	$SourcePath = (Get-Item $SourceDir).FullName
	$DestinationPath = (Get-Item $DestinationDir).FullName
	
	if ($ManifestDiff -ne $null)
	{
		ProcessManifestDiff $ManifestDiff
	}

}

process
{
	if ($_ -ne $null)
	{
		ProcessManifestDiff $_
	}
}
